<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>sim.callScriptFunction</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1>Regular API function</h1>
<h3 class=subsectionBar><a name="simCallScriptFunction" id="simCallScriptFunction"></a>sim.callScriptFunction</h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Calls a script function (from a <a href="../plugins.htm">plugin</a>, <a href="../mainClientApplication.htm">the main client application</a>, or from another script). This represents a <a href="../callbackFunctions.htm">user callback</a> inside of a script. The target script must be initialized for this call to succeed, e.g. when calling <a href="../simulationScripts.htm">simulation scripts</a>, then simulation must be running. See also <a href="simExecuteScriptString.htm">sim.executeScriptString</a>.</td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>From C/C++, call <a href="simCallScriptFunctionEx.htm">simCallScriptFunctionEx</a> instead.</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div></div>

</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div></div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>...=sim.callScriptFunction(string functionNameAtScriptPath,int scriptHandleOrType,...)</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div><strong>functionNameAtScriptPath</strong>: a string representing the function name and script path, e.g. <em>myFunctionName@/theScriptPath</em>. When the script is not associated with an object, then just specify the function name.</div>
<div><strong>scriptHandleOrType</strong>: the handle of the script, otherwise the type of the script:</div>
<div class=tab><em>sim.scripttype_mainscript</em> (0): the <a href="../mainScript.htm">main script</a> will be called.</div>
<div class=tab><em>sim.scripttype_childscript</em> (1): a <a href="../childScripts.htm">child script</a> will be called. A script path needs to be specified (i.e. the object path where the script is attached)</div>
<div class=tab><em>sim.scripttype_customizationscript</em> (6): a <a href="../customizationScripts.htm">customization script</a> will be called. A script path needs to be specified (i.e. the object path where the script is attached)</div>
<div class=tab><em>sim.scripttype_sandboxscript</em> (8): <a href="../sandboxScript.htm">the sandbox script</a> will be called.</div>
<div class=tab><em>sim.scripttype_addonscript</em> (2): an <a href="../addOns.htm">add-on script</a> will be called (the add-on needs to be running). An add-on name needs to be specified (e.g. for  add-on <em>simAddOnB0RemoteApiServer.lua</em>, <em>B0RemoteApiServer</em> is the add-on name)</div>
<div><strong>...</strong>: any number of arguments that will be handed over to the called function.</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div><strong>...</strong>: any number of return values from the called function.</div>
</td> 
</tr> 

<tr class=apiTableTr> 
<td class=remApiTableLeftCParam>
Remote API equiv.
</td> 
<td class=remApiTableRightCParam>
<div>B0-based remote API: <a href="../b0RemoteApi-cpp.htm#simxCallScriptFunction">simxCallScriptFunction</a></div>
<div>Legacy remote API: <a href="../remoteApiFunctions.htm#simxCallScriptFunction">simxCallScriptFunction</a></div>
</td> 
</tr> 

</table> 


<br>
</td>
</tr>
</table>
</div>
</body>
</html>
